package com.zxx.paysdk.service.repository

import com.zqq.baselibrary.http.RetrofitFactory
import com.zqq.baselibrary.http.rx.BaseResp
import com.zxx.paysdk.service.api.PayApi
import com.zxx.paysdk.service.bean.GetPaySignReq
import com.zxx.paysdk.service.bean.PayOrderReq
import rx.Observable
import javax.inject.Inject

/**
 * 支付数据层
 * wc
 * @author zqq on 2019/9/16.
 */
class PayRepository @Inject constructor() {


    //获取支付宝支付签名
    fun getPaySign(orderId: Int, totalPrice: Long): Observable<BaseResp<String>> {
        return RetrofitFactory.instance
                .create(PayApi::class.java)
                .getPaySign(GetPaySignReq(orderId, totalPrice))
    }


    //刷新订单状态已支付
    fun payOrder(orderId: Int): Observable<BaseResp<String>> {
        return RetrofitFactory.instance
                .create(PayApi::class.java)
                .payOrder(PayOrderReq(orderId))
    }

}